package behavior.memento;

public class GameRole {
    private int vit;
    private int def;


    public GameRole( int vit,int def) {
        this.def = def;
        this.vit = vit;
    }
    void setNewValue(int vit,int def){
        this.def = def;
        this.vit = vit;
    }

    //备忘恢复
    Memento createMemento(){
        return  new Memento(vit,def);
    }
    void recover(Memento memento){
        vit = memento.getVit();
        def = memento.getDef();
    }

    @Override
    public String toString() {
        return "GameRole{" +
                "vit=" + vit +
                ", def=" + def +
                '}';
    }
}
